From 10007b5bce8a2182100caae8fbe18078c7804009 Mon Sep 17 00:00:00 2001 From: Edward E Date: Thu, 1 Dec 2016 18:39:11 -0600 Subject: [PATCH] babl-cache: implement a better cache path on Win32 Use SHGetFolderPathA() to get the user local data path (the same path GEGL uses for plugins on Win32) https://bugzilla.gnome.org/show_bug.cgi?id=774491 --- babl/babl-cache.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/babl/babl-cache.c b/babl/babl-cache.c index c8a5dbd..723ee50 100644 --- a/babl/babl-cache.c +++ b/babl/babl-cache.c @@ -16,6 +16,10 @@ * . */ +#ifdef _WIN32 +#include +#endif + #include #include #include "config.h" @@ -77,8 +81,13 @@ static const char *fish_cache_path (void) if (getenv ("HOME")) sprintf (path, "%s/.cache/babl/babl-fishes", getenv("HOME")); #else - if (getenv ("TEMP")) +{ + char win32path[4096]; + if (SHGetFolderPathA (NULL, CSIDL_LOCAL_APPDATA, NULL, SHGFP_TYPE_CURRENT, win32path) == S_OK) + sprintf (path, "%s\\%s\\babl-fishes.txt", win32path, BABL_LIBRARY); + else if (getenv ("TEMP")) sprintf (path, "%s\\babl-fishes.txt", getenv("TEMP")); +} #endif if (stat (path, &stat_buf)==0 && S_ISREG(stat_buf.st_mode)) -- 2.30.2